<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 全局变量规则
Route::pattern([
    'id'           => '\d+',
    'category_id'  => '\d+',
    'good_mods_id' => '\d+',
    'goods_id'     => '\d+',
]);

// 后台管理登录
Route::get('manage', 'manage/login/index');

// 退出登录
Route::post('quit', 'manage/login/quit');
// 商户后台管理登录
Route::get('shop', 'shop/login/index');
// 商户退出登录
Route::post('shopquit', 'shop/login/quit');
Route::get('test',function (){
    function jie($n){
        if($n==1){
            return 1;
        }else{
            dump( $n);
            return jie($n-1)*$n;
        }
    }

    echo jie(10);
});
//////////////////////////////////////////////////////////////////////////
////////////////////////////// 前端接口 //////////////////////////////
//////////////////////////////////////////////////////////////////////////
Route::group('api',function (){
    /*---------------公众号登录----------------*/
    // 小程序授权
    Route::post('login', 'api/v1.login/weixinGetOpenId');
    //获取手机号
    Route::post('get/mobile','api/v1.Wechat/weixinGetData');
    //绑定手机号
    Route::post('binding/mobile','api/v1.Index/bindingMobile');
    //生日提醒
    Route::get('birthday/reminder','api/v1.Index/birthdayReminder');
    //兑礼计划
    Route::get('cash/plan','api/v1.Index/cashPlan');
    //贵宾尊享
    Route::get('vip/enjoy','api/v1.Index/VipEnjoy');
    //积分管理初始化
    Route::get('points/management/init','api/v1.Index/pointsManagementInit');
    //积分明细
    Route::get('points/log/list','api/v1.Index/pointsLogList');
    //入会方式
    Route::get('ways/join','api/v1.Index/waysJoin');
    //商品兑换初始化
    Route::get('cash/goods/list/init','api/v1.Index/cashGoodsListInit');
    //选择分类获取商品
    Route::get('choice/category','api/v1.Goods/choiceCategory');
    //商品详情
    Route::get('goods/detail', 'api/v1.goods/detail');
    //上传图片
    Route::post('upload$', 'api/v1.upload/upload');
    /*---------------收货地址----------------*/
    //省市区的三级联动
    Route::get('region', 'api/v1.Stores/region');
    // 获取用户默认收货地址
    Route::post('user/def/addr', 'api/v1.member_addresses/defAddr');
// 设置用户默认收货地址
    Route::post('user/set/def/addr', 'api/v1.member_addresses/setDefAddr');
// 获取用户收货地址
    Route::post('user/get/addresses', 'api/v1.member_addresses/addresses');
// 编辑用户收货地址
    Route::post('user/edit/address', 'api/v1.member_addresses/editAddress');
// 删除用户收货地址
    Route::post('user/del/address', 'api/v1.member_addresses/delAddress');
    /*---------------订单----------------*/
    // 确认订单
    Route::post('confirm/order', 'api/v1.orders/confirmOrder');
// 添加订单
    Route::post('add/order', 'api/v1.orders/add');
// 兑换记录 订单列表
    Route::post('order/list', 'api/v1.orders/orderList');
// 兑换详情 订单详情
    Route::post('order/detail', 'api/v1.orders/order_detail');
    //删除订单
    Route::post('order/delete','api/v1.orders/orderDelete');

})->crossDomainRule();





